package com.hdwmw.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.hdwmw.ZFActivity;
import com.hdwmw.constant.Constant;
import com.hdwmw.json.JsonParser;

public class FZEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3953147276335127960L;
	private String rent_userid;
	private String rent_username;
	private String rent_password;
	private String rent_realname;
	private String address;
	private String rent_areaid;
	private String rent_areaname;
	private String phoneNumber;
	private String pre1;
	private String pre2;
	private String hotelname;
	private String imgUrl;
	private String roomNum;
	private String date;
	private String intro;
	private int price_level; 
	public String getRent_userid() {
		return rent_userid;
	}
	public void setRent_userid(String rent_userid) {
		this.rent_userid = rent_userid;
	}
	public String getRent_username() {
		return rent_username;
	}
	public void setRent_username(String rent_username) {
		this.rent_username = rent_username;
	}
	public String getRent_password() {
		return rent_password;
	}
	public void setRent_password(String rent_password) {
		this.rent_password = rent_password;
	}
	public String getRent_realname() {
		return rent_realname;
	}
	public void setRent_realname(String rent_realname) {
		this.rent_realname = rent_realname;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getRent_areaid() {
		return rent_areaid;
	}
	public void setRent_areaid(String rent_areaid) {
		this.rent_areaid = rent_areaid;
	}
	public String getRent_areaname() {
		return rent_areaname;
	}
	public void setRent_areaname(String rent_areaname) {
		this.rent_areaname = rent_areaname;
	}
	public String getPhoneNumber() {
		return phoneNumber;
	}
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
	public String getPre1() {
		return pre1;
	}
	public void setPre1(String pre1) {
		this.pre1 = pre1;
	}
	public String getPre2() {
		return pre2;
	}
	public void setPre2(String pre2) {
		this.pre2 = pre2;
	}
	public String getHotelname() {
		return hotelname;
	}
	public void setHotelname(String hotelname) {
		this.hotelname = hotelname;
	}
	public String getImgUrl() {
		return Constant.baseUrl + imgUrl;
	}
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}
	public String getRoomNum() {
		return roomNum;
	}
	public void setRoomNum(String roomNum) {
		this.roomNum = roomNum;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public String getIntro() {
		return intro;
	}
	public void setIntro(String intro) {
		this.intro = intro;
	}
	
	
	
	public int getPrice_level() {
		return price_level;
	}
	public void setPrice_level(int price_level) {
		this.price_level = price_level;
	}
	public static List<FZEntity> getZDFList(String json) {
		List<FZEntity> list = null;
		if(json != null) {
			try {
				JSONObject jo = new JSONObject(json);
				if(jo != null) {
					if(jo.optInt("RESP_CODE") == 1) {
						JSONArray ja = jo.optJSONArray("QRY_RENT_SHOP_INFO_RSP_DATA");
						if(ja != null) {
							list = new ArrayList<FZEntity>();
							for(int i = 0; i < ja.length(); i++) {
								JSONObject jo_entity = ja.optJSONObject(i);
								FZEntity fe = new FZEntity();
								fe.setAddress(jo_entity.optString("address"));
								fe.setHotelname(jo_entity.optString("hotelname"));
								fe.setImgUrl(jo_entity.optString("imgUrl"));
								fe.setIntro(jo_entity.optString("intro"));
								fe.setPhoneNumber(jo_entity.optString("phoneNumber"));
								fe.setPre1(jo_entity.optString("pre1"));
								fe.setPre2(jo_entity.optString("pre2"));
								fe.setRent_areaid(jo_entity.optString("rent_areaid"));
								fe.setRent_areaname(jo_entity.optString("rent_areaname"));
								fe.setRent_password(jo_entity.optString("rent_password"));
								fe.setRent_realname(jo_entity.optString("rent_realname"));
								fe.setRent_userid(jo_entity.optString("rent_userid"));
								fe.setRent_username(jo_entity.optString("rent_username"));
								fe.setRoomNum(jo_entity.optString("roomNum"));
								fe.setPrice_level(jo_entity.optInt("price_level"));
								list.add(fe);
							}
						}
					}
				}
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
		return list;
	}
}
